import request from '@/utils/request'

// 获取优惠券列表
export const fetchCouponList = (params) => {
    return request({
        url: '/coupon/list',
        method: 'get',
        params: params
    })
}

// 创建优惠券
export const createCoupon = (data) => {
    return request({
        url: '/coupon/create',
        method: 'post',
        data: data
    })
}

// 获取优惠券详情
export const getCoupon = (id) => {
    return request({
        url: '/coupon/' + id,
        method: 'get'
    })
}

// 更新优惠券
export const updateCoupon = (id, data) => {
    return request({
        url: '/coupon/update/' + id,
        method: 'post',
        data: data
    })
}

// 删除优惠券
export const deleteCoupon = (id) => {
    return request({
        url: '/coupon/delete/' + id,
        method: 'post',
    })
}

// 历史优惠券列表
export const couponHistoryList = (params) => {
    return request({
        url: '/couponHistory/list',
        method: 'get',
        params: params
    })
}